package com.lianzhihui.romeex.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.inter.SelectListener;

import java.util.ArrayList;
import java.util.List;

/**
 * Description: 过滤器弹窗 适配器
 * Author: RAMON
 * CreateDate: 12/1/20 10:47 AM
 * UpdateUser:
 * UpdateDate:
 * UpdateRemark:
 * Version:
 */
public class FilterAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    List<String> list;
    String selectStr = "全部";
    SelectListener listener;

    public FilterAdapter() {
        super(R.layout.item_filter_layout);
        this.list = new ArrayList<>();
        list.add("全部");
        list.add("排队中");
        list.add("重新排队");
        list.add("收益中");
        list.add("已结束");
    }

    public FilterAdapter(@Nullable List<String> data) {
        super(R.layout.item_filter_layout, data);
    }

    public void setListener(SelectListener listener) {
        this.listener = listener;
    }

    public void setSelectStr(String selectStr) {
        this.selectStr = selectStr;
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.tv_name, item);
        if (selectStr.equals(item)) {
            helper.setVisible(R.id.iv_select, true);
            helper.setTextColor(R.id.tv_name,mContext.getResources().getColor(R.color.yellow));
        } else {
            helper.setVisible(R.id.iv_select, false);
            helper.setTextColor(R.id.tv_name,mContext.getResources().getColor(R.color.text333));
        }
    }
}
